module dgl.graphics.GraphicsDevice;

import derelict.opengl.gl;

import dgl.Matrix;
import dgl.Vector4;
import dgl.graphics.Color;

static class GraphicsDevice
{
	private static Matrix m_matView;
	
	private static Matrix m_matProj;
	
	private static Color m_clearColor;
	
	public static this()
	{
		m_matView = Matrix.identity;
		m_matProj = Matrix.identity;
		m_clearColor = Color.cornflowerBlue;
	}
	
	public static Matrix matView()
	{
		return m_matView;
	}
	
	public static void matView( Matrix matView )
	{
		m_matView = matView;
	}
	
	public static Matrix matProj()
	{
		return m_matProj;
	}
	
	public static void matProj( Matrix matProj )
	{
		glMatrixMode( GL_PROJECTION );
		glLoadMatrixf( matProj.ptr );
		m_matProj = matProj;
	}

	public static Color clearColor()
	{
		return m_clearColor;
	}
	
	public static void clearColor( Color clearColor )
	{
		m_clearColor = clearColor;
		Vector4 vec = clearColor.toVector4();
		glClearColor( vec.x, vec.y, vec.z, vec.w );
	}
}